package com.mazaiting.classfile.attr.info;

import com.mazaiting.classfile.constant.ConstantPool;
import com.mazaiting.classfile.interfaces.Reader;
import lombok.Getter;

/**
 * 属性信息接口
 *
 * @author mazaiting
 * @since 2021/8/12
 */
@Getter
public abstract class AttributeInfo implements Reader {
    /**
     * 属性名索引 无符号 u2
     */
    protected final int nameIndex;

    /**
     * 属性名索引 无符号 u4
     */
    protected final int length;

    /**
     * 常量池
     */
    protected final ConstantPool pool;

    public AttributeInfo(ConstantPool pool, int index, int length) {
        this.pool = pool;
        this.nameIndex = index;
        this.length = length;
    }

    @Override
    public String toString() {
        return "AttributeInfo{" +
                "nameIndex=" + nameIndex +
                ", length=" + length +
                '}';
    }
}


















